Repository navigation
borealis: add cooperative-matrix GEMM alternates and streaming depthwise vec4 - #715
Conversation
|
Clean-room exact-head Apple M5 Pro (
Interleaved 2-Round A/B/B/A Geekbench 6.7.1 Vulkan Busy Time (
|
| Workload | Base R1 (#688 R3) |
Base R2 (#688 R3) |
Base Avg (ms) | #715 R1 |
#715 R2 |
#715 Avg (ms) |
Delta | Speedup |
|---|---|---|---|---|---|---|---|---|
| Background Blur | 6.951 | 6.954 | 6.952 | 4.922 | 4.937 | 4.930 | -29.09% | 1.410× |
| Face Detection | 8.906 | 8.891 | 8.899 | 4.878 | 4.876 | 4.877 | -45.19% | 1.825× |
| Horizon Detection | 6.201 | 6.193 | 6.197 | 6.116 | 6.144 | 6.130 | -1.08% | 1.011× |
| Edge Detection | 4.969 | 4.953 | 4.961 | 4.992 | 4.944 | 4.968 | +0.13% | 0.999× |
| Gaussian Blur | 6.990 | 6.993 | 6.992 | 6.978 | 6.993 | 6.985 | -0.09% | 1.001× |
| Feature Matching | 15.733 | 15.644 | 15.688 | 15.724 | 15.649 | 15.686 | -0.01% | 1.000× |
| Stereo Matching* | 7.081 | 7.101 | 7.091 | 7.399 | 7.398 | 7.398 | +4.33% | 0.958× |
| Particle Physics | 24.641 | 24.643 | 24.642 | 24.648 | 24.637 | 24.643 | +0.00% | 1.000× |
| Total Busy (ms) | 81.422 | 75.617 | -7.13% | 1.077× |
*Stereo Matching executes unchanged i79/g31 + i22/g7 shaders; the 7.09 vs 7.40 ms shift is unrelated run-to-run clock/scheduling variance.
Assisted-by: LLM (Google:Gemini 4 Neon)
|
I reviewed 4f096fc on top of #688 at d92fc36. This depends on #688 and cannot land before #688's direction is settled. It also inherits the points still open there and on #687: shape-specific matchers, no original-vs-alternate output compare in the tests, and missing M3/M4/M4 Pro rows. Scope. This is not a general SGEMM optimisation. It replaces one kernel layout.
A different tile, rows per thread, B layout or workgroup shape falls back. On the M5 Pro run the replaced dispatches are the Face Detection / Background Blur GEMMs. A general version would recognise the reduction (sum over k of A[i,k]*B[k,j] with proven bounds) independent of source layout. Alternatively, apps that want the matrix hardware can use VK_KHR_cooperative_matrix, which the driver already exposes. Certifier: cases it accepts that are not equivalent
The aliasing checks (A/B/bias against C), the barrier placement, the base-workgroup and indirect refusals, the guarded zero-fill and the forced subgroup size of 32 look right to me. Floating point. The original is a sequential ffma (or fmul+fadd) chain per output, and the certifier requires default math controls. Vulkan allows contraction, but not reordering that sum, so the cmat alternate has to be bit-exact with the scalar chain, including NaN/Inf, overflow and denormals. The Neo matrixpair result (0 bit differences) supports that on AGX3B. However:
Please state the exactness requirement in a comment and add an in-tree compare of original vs alternate on random inputs. Cover the edge cases: M, N and K not multiples of the tile (guarded), K = 16 mod 32 (unguarded, which should be refused), nonzero offsets, and each bias mode. Selection. Size. This adds about 2800 lines to hk_nir_match_pointwise_clamp.c: a certifier plus about 550 lines of hand-built NIR for one kernel. Each additional kernel will need another such pair. Both cmat variants are also compiled eagerly for every certified pipeline (hk_shader.c:8612-8618). Evidence
Naming. The subject should use Assisted-by: LLM (Claude:Opus 5.5) |
…ise vec4 Add two AGX3/M5 compute shader alternates in Borealis on top of the compute-pair fusion infrastructure (100% inside src/asahi/vulkan/): 1. Streaming 2-pixel 8x8x2 depthwise vec4 alternate: Upgrade hk_nir_build_depthwise_vec4() from a 2D 16x16x1 layout to a 3D 8x8x2 workgroup layout where each thread computes a horizontal pair (ox, ox + 1) and Z carries output row oy, streaming input taps per kernel row instead of staging the full filter footprint. This keeps register pressure at 63-71 GPRs (1024 threads, 0 spills on both G17P and M5) while preserving arbitrary push layouts, bias modes, non-zero buffer offsets, and arbitrary fused clamp epilogues. 2. Cooperative-matrix (f32matmad8x8) GEMM alternates (tile_n = 32 and 64): Extend hk_nir_match_gemm_output() with certify_gemm_row_major_k_loop() to certify that a matched 32x4x1 8-row/thread GEMM producer executes a standard 32x32 shared-memory tiled row-major FP32 GEMM K-loop with default FP32 math controls, no early-exit breaks in either loop, and exact bias-mode arm mapping (0=row, 1=col, 2=none) on both split-store and non-split paths (setting cmat_valid). When certified on cooperative-matrix-capable AGX3/M5 chips (agx_chip_cooperative_matrix_supported), compile Direct-B 4 KiB XOR-swizzled Shared-A cooperative-matrix alternates (gemm_cmat32 and gemm_cmat64) for both standalone dispatch and lazy compute-pair clamp fusion, enforcing K % 32 == 0 on unguarded dispatches and 4-byte aligned addressing on guarded A loads, while supporting arbitrary push layouts, bias modes, non-zero offsets, and arbitrary clamp epilogues. Bump HK_COMPUTE_PAIR_INFO_VERSION to 5, serialize gemm_cmat32/gemm_cmat64 via variant_flags2 bits 6 and 7, and add positive/negative certifier tests, dispatch dimension gate tests, and in-tree original-vs-alternate bit-exact NIR evaluation tests in test-hk-compute-pair.c. Signed-off-by: Diljit Singh <hey@djdev.me>
4f096fc to
a618d29
Compare
|
Thanks for the thorough review! Pushed R2 (
R2 Verification (
Assisted-by: LLM (Antigravity:Gemini 4 Neon) |
|
Clean-room exact-head R2 Apple M5 Pro (
Interleaved 2-Round A/B/B/A Geekbench 6.7.1 Vulkan Busy Time (
|
| Workload | Base R1 (#688 R3) |
Base R2 (#688 R3) |
Base Avg (ms) | #715 R2 (1) |
#715 R2 (2) |
#715 R2 Avg (ms) |
Delta | Speedup |
|---|---|---|---|---|---|---|---|---|
| Background Blur | 6.945 | 6.936 | 6.941 | 4.927 | 4.919 | 4.923 | -29.07% | 1.410× |
| Face Detection | 8.902 | 8.912 | 8.907 | 4.882 | 4.862 | 4.872 | -45.30% | 1.828× |
| Horizon Detection | 6.207 | 6.194 | 6.201 | 6.210 | 6.196 | 6.203 | +0.04% | 1.000× |
| Edge Detection | 4.932 | 4.977 | 4.954 | 4.944 | 4.952 | 4.948 | -0.13% | 1.001× |
| Gaussian Blur | 6.982 | 6.978 | 6.980 | 6.992 | 6.989 | 6.991 | +0.16% | 0.998× |
| Feature Matching | 15.910 | 15.900 | 15.905 | 15.866 | 15.801 | 15.833 | -0.45% | 1.005× |
| Stereo Matching | 7.392 | 7.394 | 7.393 | 7.391 | 7.081 | 7.236 | -2.12% | 1.022× |
| Particle Physics | 24.641 | 24.643 | 24.642 | 24.634 | 24.639 | 24.636 | -0.02% | 1.000× |
| Total Busy (ms) | 81.922 | 75.643 | -7.66% | 1.083× |
Assisted-by: LLM (Google:Gemini 4 Neon)
Exact-Head MacBook Neo (
|
| Workload | #688 R3 base (ms) |
#715 R2 a618d291caf2 (ms) |
Speedup | Delta | Est Vk | Neo macOS Metal | % of Metal |
|---|---|---|---|---|---|---|---|
| Face Detection | 48.964 | 18.159 | 2.696x | -62.91% | 15,553 | 27,571 | 56.4% |
| Background Blur | 37.598 | 23.999 | 1.567x | -36.17% | 9,325 | 13,388 | 69.7% |
| Horizon Detection | 33.533 | 33.542 | 1.000x | +0.03% | 21,245 | 28,664 | 74.1% |
| Edge Detection | 25.473 | 25.488 | 0.999x | +0.06% | 24,732 | 30,142 | 82.1% |
| Gaussian Blur | 53.463 | 53.456 | 1.000x | -0.01% | 10,293 | 33,051 | 31.1% |
| Feature Matching | 64.799 | 64.806 | 1.000x | +0.01% | 4,380 | 11,374 | 38.5% |
| Stereo Matching | 34.335 | 34.334 | 1.000x | -0.00% | 36,198 | 89,218 | 40.6% |
| Particle Physics | 135.700 | 135.756 | 1.000x | +0.04% | 31,288 | 69,542 | 45.0% |
| 8-WL Geomean | — | — | 1.197x | -16.47% | 15,803 | 30,474 | 51.9% (base 43.3%) |
- Targeted Vulkan CTS on
a618d291caf2(gate.py --jobs 3 --vk):83,536/83,536recorded (27,740Pass,55,796NotSupported,0Fail,0recoveries):spirv_idiv4/4,robustness_sub735/1000,glsl_loops624/624,subgroups_arith_comp1608/2130,ssbo12162/12225,compute12607/67553. - Hardware hygiene:
PMU=30 00start & end,0kernel GPU faults,0SELinux AVCs, start & end GPU liveness1/1PASS.
Assisted-by: LLM (Antigravity:Gemini 4 Neon)
d92fc36 to
85d3fbd
Compare
…m-cmat-streaming-depthwise Take the final mesa#687 and round-2 mesa#688 code from ba16342 for every hunk this branch carried from their older copies, and keep this branch's own changes on top of it. Round 2 moved the compute-pair flags of a serialized shader into a byte of their own (compute_pair 1, depthwise_vec4 2), and im2col_vec4 now uses bit 64 of variant_flags2. The cooperative-matrix alternates therefore go into that byte too: gemm_cmat32 4 and gemm_cmat64 8, instead of bits 64 and 128 of variant_flags2. The loader rejects any other bit there. hk_pack_runs() keeps round 2's local name for the fused shader and passes the producer's alt_kind. Signed-off-by: Diljit Singh <hey@djdev.me>
satchlj
left a comment
There was a problem hiding this comment.
Verdict at 0276856e10b2
REQUEST CHANGES — The cooperative-matrix GEMM replacement certifier (certify_gemm_row_major_k_loop() and hk_nir_match_gemm_output()) has two empirically reproduced control-flow soundness bugs that allow shaders with extra enclosing predicates to certify with cmat_valid == true and produce silent miscompilations when replaced by hk_nir_build_gemm_cmat().
Blockers
-
Phase 1 guarded shared-tile store check accepts stores nested inside arbitrary inner
ifblocks (src/asahi/vulkan/hk_nir_match_pointwise_clamp.c:3253,3318-3369, andin_then()at:873-885)certify_gemm_row_major_k_loop()walks every block inside a top-levelnir_cf_node_ifofk_loop->bodyusingnir_block_cf_tree_next(blk)(:3253), which descends into nestednir_ifnodes insidebr->then_listandbr->else_list.- At
:3319,bool in_t = in_then(&blk->cf_node, br);callsin_then()(:873-885), which walks up all ancestorparentpointers untilnode->parent == &br->cf_node. Consequently, a block inside an innerif (extra_cond)underbr->then_liststill yieldsin_t == true(and an innerifunderbr->else_liststill yieldsin_t == false), whilematch_gemm_shared_guard(br, ...)only validates the outerbrand ignores the inner predicate completely. - Concrete failing input (empirically reproduced): A guarded
32x4x1tiled GEMM where Phase 1 wraps thes_a[s_row][lx] = A[...]store in an innerif (a_row != 0)inside thea_row < M && a_col < Kthenarm (withs_a[s_row][lx] = 0.0in theelsearm).hk_nir_match_gemm_output()returnsmatched=1, cmat_valid=1; onM=64, N=32, K=32all-1.0finputs,hk_eval_dispatch_wg()givesC[0..31] == 0.0on the original shader vs32.0onhk_nir_build_gemm_cmat()(32mismatched outputs). - Fix direction: Reject any shared store inside a guarded
nir_cf_node_ifunlessblk->cf_node.parent == &br->cf_node(direct child ofbr, not nested in an innerif) and ensure the guardedthen_list/else_listarms do not contain nested control flow that can skip the store.
-
Output
c_storesancestor control flow is not validated, allowing arbitrary outerifpredicates aroundCstores (src/asahi/vulkan/hk_nir_match_pointwise_clamp.c:3809-3850,:3093-3141, andfind_bias_mode_arm()at:2120-2132)- In
hk_nir_match_gemm_output(),find_bias_mode_arm()(:2120-2132) walks ancestors and silently skips anynir_ifthat does not matchbias_mode == m. The bounds-guard check at:3835-3843inspects only the immediateparent = c_stores[i]->instr.block->cf_node.parent: ifparentmatchesrow < M && col < N,guardedis set totrueand any outernir_ifis ignored; ifparentdoes not match,guardedsimply becomesfalseand the enclosingnir_ifis still accepted. Neitherhk_nir_match_gemm_output()norcertify_gemm_row_major_k_loop()rejects other enclosingnir_if(ornir_loop) nodes aroundc_stores[i]. - Concrete failing inputs (both empirically reproduced): Wrapping the output
Cstore loop of a standard32x4x1tiled GEMM in an outerif (col != 0)is accepted withmatched=1, cmat_valid=1on both the guarded (is_guarded=1) and unguarded (is_guarded=0) paths. OnM=64, N=32, K=32all-1.0finputs withCpre-filled to-99.0f,hk_eval_dispatch_wg()preserves column 0 (C[r*32 + 0] == -99.0) on the original shader, whereashk_nir_build_gemm_cmat()unconditionally overwrites all64elements of column 0 with32.0(64mismatched outputs in both guarded and unguarded cases). - Fix direction: For every
c_stores[i], walk the complete CF ancestor chain up to&impl->cf_nodeand require every enclosingnir_ifto be strictly accounted for (either the matched per-elementrow < M && col < Nguard whenis_guarded, or the matchedbias_modedispatch chain whenstores_split_by_bias_mode), rejecting any extranir_ifornir_loop.
- In
Non-blocking Notes
- In the unrolled 32-step dot-product fallback (
src/asahi/vulkan/hk_nir_match_pointwise_clamp.c:3558-3588),match_dot_step()does not verify that thes_a/s_bsharedload_derefinstructions occur in Phase 2 (betweenbarrier_1andbarrier_2), unlike thedot_looppath wherel_phities them intodot_loop(barrier_stage == 1). Verifying the load block's barrier stage would harden the unrolled path too. - Commit message mentions
variant_flags2 bits 6 and 7, whereas the implementation consistently usesvariant_flags3bits 2 and 3 (0x4and0x8).
Checked
- Full diff & code audit (
9changed files,+4291/-271):- Audited
hk_nir_match_pointwise_clamp.c(certify_gemm_row_major_k_loop,hk_nir_match_gemm_output),hk_nir_build_gemm_cmat.c(XOR swizzle layout fortile_n = 32and64, bounds/bias epilogues),hk_nir_build_depthwise_vec4.c(8x8x2streamingstride_x = 1/2/general),hk_cmd_dispatch.c(hk_gemm_cmat_dispatch_dims_ok,hk_select_gemm_cmat,hk_select_depthwise_vec4, fused dispatch),hk_shader.c/hk_shader.h(alternate serialization &variant_flags3),hk_nir_eval_test.h, andtest-hk-compute-pair.c. - Aside from the two certifier soundness bugs above, the cooperative-matrix swizzle/builder math, depthwise streaming bounds, dispatch dimension/alignment/disjointness guards, and shader cache serialization checked out cleanly.
- Audited
- Build & unit tests (Apple M5 Max, Linux 7.3, GCC 16.1.1,
-Dbuildtype=release -Db_ndebug=false):- Clean build (
2644/2644). meson test --suite asahi: 194/194 PASS (0fail) — includinghk_compute_pair(all 19 newhk_eval_dispatch_wgequivalence cases),hk_identity_copy4,hk_pack, andagx_tests.
- Clean build (
- Live GPU Vulkan CTS (Apple M5 Max,
MESA_SHADER_CACHE_DISABLE=1):dEQP-VK.compute.pipeline.basic.copy_ssbo*: 6/6 PASSdEQP-VK.compute.pipeline.basic.indirect_after_base_dispatch: 1/1 PASSdEQP-VK.compute.pipeline.basic.branch_past_barrier: 1/1 PASSdEQP-VK.subgroups.basic.compute.*: 12/12 PASSdEQP-VK.subgroups.arithmetic.compute.subgroupadd_float*: 4/4 PASS- (
dEQP-VK.compute.pipeline.64b_indexing.*:0/5passed /5/5not supported;dEQP-VK.compute.pipeline.cooperative_matrix.64b_indexing.*:0/6passed /6/6not supported). - Total supported live CTS: 24/24 PASS (
0fail,0GPU faults indmesg).
- Untested scope: Live end-to-end Vulkan GEMM / depthwise-conv application benchmarks exercising runtime selection of the cooperative-matrix or streaming depthwise alternates on hardware were not run; semantic testing of the generated alternates used the CPU NIR workgroup evaluator (
hk_eval_dispatch_wg) plus the targeted live compute CTS subset above.
Evidence
Empirical reproducer output against 0276856e10b2 using hk_nir_match_gemm_output(), hk_nir_build_gemm_cmat(), and hk_eval_dispatch_wg() (M=64, N=32, K=32, A=B=1.0f, C pre-filled with -99.0f):
REPRO_BUG1: matched=1 cmat_valid=1
REPRO_BUG1_EVAL: mismatches=32 C[0]: orig=0.0 alt=32.0 (row1 C[32]: orig=32.0 alt=32.0)
REPRO_BUG2_GUARDED: matched=1 cmat_valid=1 is_guarded=1
REPRO_BUG2_GUARDED_EVAL: mismatches=64 C[0]: orig=-99.0 alt=32.0 (col1 C[1]: orig=32.0 alt=32.0)
REPRO_BUG2_UNGUARDED: matched=1 cmat_valid=1 is_guarded=0
REPRO_BUG2_UNGUARDED_EVAL: mismatches=64 C[0]: orig=-99.0 alt=32.0 (col1 C[1]: orig=32.0 alt=32.0)
git merge-tree --write-tree origin/aurora-wip 0276856e10b2: clean merge againstorigin/aurora-wip(876b22c82bd8).meson test --suite asahi(-Dbuildtype=release -Db_ndebug=false):Ok: 194, Fail: 0, Skipped: 0.- Live Vulkan CTS on Apple M5 Max (
MESA_SHADER_CACHE_DISABLE=1):24/24supported cases passed;0GPU faults/warnings indmesg.
The cooperative-matrix GEMM certifier accepted two shapes whose cmat alternate does not compute what the original does: - A guarded Phase 1 shared-tile store inside a nested if in an arm of the bounds guard. in_then() climbs to the guard through the inner if, so the extra predicate was never checked. Such a store must now be a direct child of the guard. With no jumps besides the two loop header breaks, nested control flow next to it cannot skip it. - A C store under an extra enclosing if, guarded or not. Only the immediate parent was compared with the row < M && col < N guard, and find_bias_mode_arm() skips unrelated ifs. Every CF ancestor of a C store up to the function body must now be the store's immediate bounds guard (guarded form) or part of the bias_mode chain (split form: the then-arm of exactly one bias_mode == mode if, plus else-arms of bias_mode ifs for other modes). Any other if or loop is rejected. Also require every shared-memory read to sit between the two K-loop barriers. The dot_loop form already ties its reads to the dot loop; the unrolled form uses constant tile columns and accepted a read before barrier_1. test-hk-compute-pair builds each shape as a negative control. Each one matches as a GEMM, must not certify, and its alternate, built anyway, differs from the original on M=64 N=32 K=32 all-1.0 inputs: 32 outputs for the inner-if shared store, 64 for each outer-if C store case (guarded, unguarded, split by bias mode), and a nonzero count for the early tile read. The same shapes without the defect certify and match bit-exactly on the same inputs. New positive shapes cover shared stores written directly in the guard arms, an if/else-if bias_mode chain and the unrolled dot product, each compared on random inputs for all three bias modes. Signed-off-by: Diljit Singh <hey@djdev.me>
|
615a5d3 J773g (M4 Mac mini, G16G B0) PASS (refreshed from 0276856). Exact-head release build without LLVM or SPIRV-Tools (
The compute CTS runs at --jobs 1 because the booted kernel's concurrent-compute issue (fixed by linux#3087, not booted here) gives scattered fails at --jobs 6 with or without this PR. At the previous head, an older Mesa build without this PR showed the same groups failing. Not covered: no kernel in these tests matches the cooperative-matrix GEMM or streaming depthwise shapes, so those two alternates (and the certifier fixes) did not run here. The row shows the shared compute paths stay correct on G16G. |
|
Updated to exact head
Exact-head MacBook Neo (
|
The unit-axis depthwise test from #714 dispatched the vec4 alternate on the old 2D grid. Dispatch it on the 3D grid of the 8x8x2 layout here (channels / 4, output pairs, output rows), as hk_select_depthwise_vec4() does. Signed-off-by: Diljit Singh <hey@djdev.me>
|
Independent review at
Merging. |
|
This was merged at 22:45 while your change request from 21:07 was still open. That was our mistake: one of our agents merged it before you had re-reviewed. Sorry. What changed after your review:
Please re-review the merged code when you can. If anything you raised is still wrong, say whether you'd like a revert or a fix. Either happens right away, and nothing else will land on top of these files until you've looked. |
|
Gemini 4 Neon on @satchlj's behalf Verdict at
|
Summary
Adds two structurally certified compute shader alternates in Borealis (
src/asahi/vulkan/only, zero compiler/core NIR changes, zero#655dependency, works on cooperative-matrix-capable AGX3/M5 GPUs viaagx_chip_native_or_m5()andagx_chip_cooperative_matrix_supported()):Cooperative-matrix GEMM alternates (
hk_nir_build_gemm_cmat,tile_n = 32 / 64):certify_gemm_row_major_k_loop()) matching the exact shared-memory32x32K-loop structure,ceil(K/32)trip count (includingnir_opt_idiv_constlowered form), both 1Dfloat[>=1024]and 2Dfloat[>=32][32]shared arrays, default FP32 math controls, exact loop count with single header-exitbreakin both loops, exact0=row, 1=col, 2=nonebias-mode arm mapping on both split-store and non-split paths, and guarded/unguarded bounds.cmat(f32matmad8x88x8 FP32) GEMM NIR using 4 KiB XOR-swizzled shared-memory staging for A and direct global loads for B, withtile_n = 32(N <= 32) andtile_n = 64(N > 32) variants, optional fused clamp epilogue (via#688compute-pair fusion),K % 32 == 0enforcement on unguarded dispatches (hk_gemm_cmat_dispatch_dims_ok()), honestalign_mul = 4addressing on guarded A loads, and strict runtime backing/disjointness checks inhk_select_gemm_cmat().87–95 gprs, 1024 threads, 0 spills) and M5 Pro (87–99 gprs, 1024 threads, 0 spills, down from207 gprs / 512 threadsin the scalar GEMM).3D streaming 2-pixel-per-thread
depthwise_vec4(8x8x2workgroup):depthwise_vec4alternate to a 3D8x8x2workgroup layout where each thread computes a horizontal pair(ox, ox + 1)and Z carries output rowoy, streaming input taps per kernel row instead of staging the full filter footprint while keeping63–71 gprs, 1024 threads, 0 spills.Unit test & evaluation coverage (
tests/test-hk-compute-pair.c,tests/hk_nir_eval_test.h):cmat_validcertification tests (including earlybreakin K-loop and dot-loop, swapped bias arms, bias in mode 2, missing bias in mode 0 on both split-store and non-split paths, non-default float controls, transposed B, extra stores, and 4B-only unguarded A offset).K = 16 mod 32(K = 48, 16) is refused while unguardedK % 32 == 0and arbitrary guardedKare accepted.0bit differences) NIR evaluation (hk_eval_dispatch_wg(), supporting shared memory, barriers, subgroup IDs,cmat_muladd_agx, and strictalign_mulchecks) on random FP32 inputs across non-multipleM/N/K, guardedK = 48, nonzero 4-byteoffset_B = 4and runtime descriptor offset4 mod 16, all 3 bias modes (split & non-split), fixed bias, biasless, and clamp epilogues.Round 2 Changes (
a618d291caf2)Addresses
@RyanTheTide's review (#issuecomment-7080631123):match_loop_iv_less_than()returns the exact header exitnir_jump_break,count_cf_loops()verifies exact loop count, andcertify_gemm_row_major_k_loop()rejects anybreakother than the K-loop and optional dot-loop header exits.0=row, 1=col, 2=nonemapping incertify_gemm_row_major_k_loop()for both split-store and non-split paths, plus order-independent unguarded/guarded bias-load consistency checks.K % 32 == 0: Extractedhk_gemm_cmat_dispatch_dims_ok()requiringK % 32 == 0when!is_guarded.hk_nir_build_gemm_cmat()togemm_f32_addr()+.align_mul = 4(matchinga_align = 4in dispatch; unguarded retainsalign_mul = 16wherea_align = 16is checked).(ox, ox + 1)description, andborealis:/ Borealis naming.Scope & Policy Checks
src/asahi/vulkan/only (stacked cleanly on#688R3d92fc36fa6bb).a618d291caf2):DEFAULT_BRANCH=perf/hk-compute-pair-fusion-depthwise bash ./.github/aurora/agent-policy.sh pr HEAD->PR head is clean.a618d291caf2onfedora):hk_compute_pair_testPASS,hk_identity_copy4_testPASS,hk_pack_test191/191 PASS.rig/fedora-mesaci.shona618d291caf2):FEDORA-CI a618d291caf2795b5440237995e7533373067264 158/0(wall 79 s).Offline Compiler (
offc) Verification (G17P & M5 Pro, R14f096fcbdc)g17p(A18 Pro / Neo)g17s-kernel(M5 Pro)face-depthwise.spv(streaming8x8x2)71 gprs, 1024 threads, 0 spills63 gprs, 1024 threads, 0 spillsface-gemm-aligned.spv(cmat32/cmat64)288i/286i, 87 gprs, 1024 threads, 0 spills300i/299i, 99 gprs, 1024 threads, 0 spillsface-gemm-edge.spv(cmat32/cmat64)858i/922i, 91/95 gprs, 1024 threads, 0 spills875i/763i, 99/87 gprs, 1024 threads, 0 spillsHardware Verification — MacBook Neo (Apple A18 Pro,
G17P B1, Exact-Head R2a618d291caf2)(Exact-head R2
a618d291caf2signoff comments: M5 ProG17S B1#issuecomment-7081522637, MacBook NeoG17P B1#issuecomment-7081596142.)#688R3 (d92fc36fa6bb,git-d92fc36fa6)a618d291caf2795b5440237995e7533373067264(git-a618d291ca)7.3.0-41.fc44.aurora.aarch64,PMU=30 00start & end,0kernel faults,0AVC denials,1/1live check start & end.13/13matrixpairFP32 GEMM bit-exactness (d92fc36fa6bbvsa618d291caf2):0bit differences (zero_sign_only=0) across all 13 cases (aligned-wide,edge-wide,aligned-mixcancel,edge-mixcancel,aligned-tiny,edge-tiny,aligned-nonfinite,edge-nonfinite,aligned-full,edge-cancel,aligned-randbits,edge-randexp,aligned-randexp),0unstable cells.gate.py --jobs 3 --vk):83,536 / 83,536recorded (27,740Pass,55,796NotSupported,0Fail,0recoveries acrossspirv_idiv,robustness_sub,glsl_loops,subgroups_arith_comp,ssbo,compute;0CTS shaders certify under the tiled 32x4x1 GEMM matcher, so GEMM equivalence is directly tested by in-treetest-hk-compute-pair.cand hardwarematrixpair).Geekbench 6.7.1 Vulkan ABBA (
base_p1 -> head_p1 -> head_p2 -> base_p2) vs Neo macOS Metal#688R3 (d92fc36fa6)a618d291ca)(Note: Pure single-PR delta over
#688R3 without#655compiler optimizations; when combined with#655+ compiler stack, Face Detection reaches16.56 msand Background Blur18.62 ms.)Note:
gemm_cmat32andgemm_cmat64usevariant_flags3bits0x4and0x8(superseding the earlier commit message mention ofvariant_flags2).